import {request} from './http.js'


export function getPublicTask(obj) {
    return request('g0/task/', {
        method: "GET",
        params: obj
    })
}

export function getSelfTask(obj) {
    return request('g1/task/', {
        method: "GET",
        params: obj
    })
}

export function getTaskDetail(taskId) {
    return request(`g0/task/${taskId}`, {
        method: "GET",
    })
}

export function addTask(obj) {
    console.log(obj)
    return request(`g1/task/`, {
        method: "POST",
        data: obj
    })
}

export function updateTask(obj) {
    console.log(obj)
    return request(`g1/task/${obj.id}`, {
        method: "PUT",
        data: obj
    })
}

export function updateStatus(taskIds, status) {
    return request(`g1/task/`, {
        method: "PATCH",
        data: {
            "ids": taskIds,
            "status": status
        }
    })
}
export function updatePublic(taskIds, isPublic) {
    return request(`g1/task/`, {
        method: "PATCH",
        data: {
            "ids": taskIds,
            "public": isPublic
        }
    })
}